package main

import (
	"fmt"
	"time"
)

func main() {

	a := make(chan int)
	//go func(){
	for i := 0; i <= 5; i++ {
		a <- i
		time.Sleep(time.Second * 1)
	}
	close(a)
	//}()
	go func() {
		for {
			select {
			case x, ok := <-a:
				if ok {
					fmt.Println(x)
					time.Sleep(time.Second * 2)
				} else {
					fmt.Println("over")
					return
				}

			}
		}
	}()

	time.Sleep(time.Second * 15)

}
